<template>
  <div id="register">
    <el-card>
      <div slot="header">用户注册</div>
      <div>
        <el-form :model="user" label-position="left" label-width="80px">
          <el-form-item label="用户名">
            <el-input v-model="user.username" placeholder></el-input>
          </el-form-item>
          <el-form-item label="邮箱">
            <el-input v-model="user.email" placeholder></el-input>
          </el-form-item>
          <el-form-item label="密码">
            <el-input v-model="user.password" placeholder></el-input>
          </el-form-item>
          <el-form-item>
            <el-button @click="register">注册</el-button>
          </el-form-item>
        </el-form>
      </div>
    </el-card>
  </div>
</template>
<script>
import { userRegister } from "@/api/login";
export default {
  data() {
    return {
      dialogTableVisible: false,
      user: {},
    };
  },
  methods: {
    register() {
      userRegister(this.user).then(() => {
        this.$router.push({
          path: "/user/login",
        });
      });
    },
  },
};
</script>